#coding=utf-8
from common import get_con
from stutils import set_django_environ
set_django_environ()

from stdj.stock.models import *
from topten import *
exdate = '2007-12-25'
con = get_con()

for s in Share.objects.order_by('code'):
    data = top10_from_db(con, s)
    if not data:continue
    data = data[:3]
    #rule 1
    eds = [i[0] for i in data]
    n = days_between2date( min(eds), max(eds))
    if n < 10:
        continue
    #rule 2
    for d in data:
        ed = d[0]
        if ed == exdate:
            print s
            break
        